<div class="row m-n">
    <div class="crumbs-bar">
        <div yb-crumbs></div>
    </div>
    <div tabset type="tab">
        <div tab heading="月度财务往来对账" ng-click="changeTab(0)">
            <div class="row wrapper-y-sm">
                <div class="operate-bar col-xs-4 font-0">
                    <button class="btn btn-operate m-r-sm" ng-click="addData()" ng-if="isZHJCH">新增</button>
                </div>
                <div class="search-bar wrapper-none col-xs-8">
                    <div class="btn-group m-l-xs pull-right">
                        <button type="button" class="btn btn-default base-color" ng-click="search()" title="刷新">
                            <i class="yb-icon ico-refresh"></i>
                        </button>
                        <button type="button" class="btn btn-default base-color" title="配置表格列"
                            ng-click="switchToolbar('ColConfig');">
                            <i class="yb-icon ico-set"></i>
                        </button>
                        <div class="btn btn-default base-color" ng-if="isZHJCH">
                            <div title="导入" ng-click="importData()">
                                <i class="yb-icon ico-import-o"></i>
                            </div>
                        </div>
                        <div class="btn btn-default base-color">
                            <div title="导出" yb-download download-url="exportParam.allUrl" download-param="condition" download-duration="3" is-ajax="true">
                                <i class="yb-icon ico-export-o"></i>
                            </div>
                        </div>
                    </div>
                    <button class="btn-advance pull-right m-l-xs" ng-click="switchToolbar('AdvanceSearch')">高级搜索</button>
                    <div class="input-group pull-right clearfix" ng-if="isZHJCH">
                        <input type="text" ng-model="condition.dealerName" class="form-control txt-search" placeholder="代理商名称">
                        <span class="input-group-addon cursor-pointer" ng-click="search(1)">搜索</span>
                    </div>
                    <div class="pull-right m-r-sm" style="margin-top: 4px;">
                        <label class="font-12 m-r-xs"><span>现金回款小计</span>:</label>
                        <toggle ng-model="cashPaymentShow" yb-click="toggleCashPaymentShow(cashPaymentShow)"></toggle>
                    </div>
                    <div class="pull-right m-r-sm" style="margin-top: 4px;">
                        <label class="font-12 m-r-xs"><span>对账当月回款合计</span>:</label>
                        <toggle ng-model="lastMonPaymentShow" yb-click="toggleLastMonPaymentShow(lastMonPaymentShow)"></toggle>
                    </div>
                </div>
            </div>
            <div yb-advance-search show-toolbar="toolbarConfig.showAdvanceSearch" search-data="search(1)" reset-data="reset()">
                <div class="advance-search m-t-sm">
                    <div class="form-group clearfix" ng-if="isZHJCH">
                        <label class="control-label"><span>代理商名称</span>：</label>
                        <textarea ng-model="condition.zhanwei" class="form-control" ng-blur="handleMultiInput($event)" placeholder="逗号分隔或者换行分隔"></textarea>
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label"><span>对账开始月份</span>：</label>
                        <input type="text" class="form-control date-picker" ng-model="condition.yearMonthDateStart"
                               datepicker-popup="{{'yyyy-MM'}}" datepicker-options="{datepickerMode:'month',minMode:'month'}"
                               ng-click="yearMonthDateEndShow=false;yearMonthDateStartShow=!yearMonthDateStartShow"
                               is-open="yearMonthDateStartShow" close-text="关闭" modal-size="small" readonly>
                    </div>
                    <div class="form-group clearfix m-b-none">
                        <label class="control-label"></label>
                        <label class="control-label wave-line">~</label>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"><span>对账结束月份</span>：</label>
                        <input type="text" class="form-control date-picker" ng-model="condition.yearMonthDateEnd"
                               datepicker-popup="{{'yyyy-MM'}}" datepicker-options="{datepickerMode:'month',minMode:'month'}"
                               ng-click="yearMonthDateStartShow=false;yearMonthDateEndShow=!yearMonthDateEndShow"
                               is-open="yearMonthDateEndShow" close-text="关闭" modal-size="small" readonly>
                    </div>
                    <div class="form-group clearfix">
                        <label class="control-label"><span>确认状态</span>：</label>
                        <select class="form-control" ng-model="condition.state">
                            <option value="">请选择</option>
                            <option value=0>待确认</option>
                            <option value=1>已同意</option>
                            <option value=2>已拒绝</option>
                        </select>
                    </div>
                    <div class="form-group clearfix" ng-if="isZHJCH">
                        <label class="control-label"><span>大区</span>：</label>
                        <input type="text" ng-model="condition.reserve2" class="form-control">
                    </div>
                    <div class="form-group clearfix" ng-if="isZHJCH">
                        <label class="control-label"><span>代理商性质</span>：</label>
                        <input type="text" ng-model="condition.reserve3" class="form-control">
                    </div>
                </div>
            </div>
            <div yb-col-config show-toolbar="toolbarConfig.showColConfig" ng-model="tableConfig" col-fixed="true"
                set-tb-style="setFixedWidth()"></div>
            <div class="main-area">
                <div yb-table-fixed class="table-fixed-wrap fix-left" ele-count="4" scroll-area="right">
                    <div class="th-fixed">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.fixedWidth"
                                            fixed-width="tbStyle.billFixedWidth"></div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="th-scroll-x" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <thead>
                                <tr>
                                    <th ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed">
                                        <div yb-thead-operate ng-model="itemCol" target-width="tableConfig.scrollWidth">
                                        </div>
                                    </th>
                                </tr>
                            </thead>
                        </table>
                    </div>
                    <div class="td-scroll-y" ng-show="dataList.length > 0">
                        <table class="table-fixed border-none" width="{{tableConfig.fixedWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index" ng-click="selectRow($index)"
                                    ng-class="{'row-selected': $index === markInfo.curRow}">
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !!itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div ng-switch="itemCol.type">
                                            <div ng-switch-when="operate">
                                                <div ng-if="isZHJCH">
                                                    <button type="button" class="btn btn-operate m-r-xs"
                                                        ng-disabled="item.state==1"
                                                        ng-click="editData(item)">编辑</button>
                                                    <button type="button" class="btn btn-operate m-r-xs"
                                                        ng-disabled="item.state==1"
                                                        ng-click="delData(item)">删除</button>
                                                </div>
                                                <div ng-if="!isZHJCH">
                                                    <button type="button" class="btn btn-operate"
                                                        ng-disabled="item.state==1"
                                                        ng-click="signData(item)">确认</button>
                                                </div>
                                            </div>
                                            <div ng-switch-default>
                                                <span>{{item[itemCol.dataField]}}</span>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="td-scroll" ng-show="dataList.length > 0" ng-style="tbStyle.billFixedWidth">
                        <table class="table-fixed border-none" width="{{tableConfig.scrollWidth}}">
                            <tbody>
                                <tr ng-repeat="item in dataList track by $index" ng-click="selectRow($index)"
                                    ng-class="{'row-selected': $index === markInfo.curRow}">
                                    <td class="spill-dots" ng-repeat="itemCol in tableConfig.tableCol track by $index"
                                        width="{{itemCol.width}}" ng-show="!!itemCol.isShow && !itemCol.isFixed"
                                        title="{{item[itemCol.dataField]}}">
                                        <div class="spill-dots">
                                            {{item[itemCol.dataField]}}
                                        </div>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </div>
                    <div class="no-data w-full text-center p-t" ng-show="dataList.length === 0">暂时没有数据</div>
                </div>
            </div>
            <div class="bottom-area page-bar wrapper-y-sm clearfix">
                <div yb-page-info ng-model="pageInfo" yb-refresh="search()"></div>
            </div>
        </div>
        <div tab heading="{{tabFlag.name}}" active="activeFlag[1]" ng-if="activeFlag[1]">
            <div class="main-area d-t-35 d-b-60">
                <form name="form" class="main-wrap form-horizontal single-col p-t clearfix" novalidate>
                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>代理商：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" name="dealerName" class="form-control light-bg"
                                ng-model="detailInfo.dealerName" ng-click="selectDealer()" required yb-focus
                                readonly placeholder="请选择">
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.dealerName.$dirty || (form.dealerName.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.dealerName.$error.required && !form.dealerName.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-xs-2 control-label"><i>*</i>对账月份：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" class="form-control date-picker" ng-model="detailInfo.reconciliateDate"
                               datepicker-popup="{{'yyyy-MM'}}" datepicker-options="{datepickerMode:'month',minMode:'month'}" name="reconciliateDate"
                               ng-click="reconciliateDateShow=!reconciliateDateShow"
                               is-open="reconciliateDateShow" close-text="关闭" modal-size="small" readonly required>
                        </div>
                        <div class="col-xs-4 msg-block"
                            ng-show="form.reconciliateDate.$dirty || (form.reconciliateDate.$invalid && submitted)">
                            <div class="error-msg" ng-if="form.reconciliateDate.$error.required && !form.reconciliateDate.focused">
                                <i class="yb-icon ico-times-circular"></i>必填项，请填写
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-xs-2 control-label">对账当月初备件欠款：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.lastMonthDebt" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonthEndDebt()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">对账当月回款合计：</label>
                        <div class="col-xs-5 control-label" style="text-align: left;">{{detailInfo.lastMonPayment||'-'}}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">现金回款小计：</label>
                        <div class="col-xs-5 control-label" style="text-align: left;">{{detailInfo.cashPayment||'-'}}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">现金汇款：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.cashTransfer" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">转服务费：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.tranServiceCharge" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">转材料费：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.tranMaterialsCharge" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">转备件政策返利：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.policyRebate" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">破碎锤融资放款：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.financialLend" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">转微挖服务费：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.tranWwServiceCharge" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">转微挖材料费：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.tranWwMaterialCharge" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleCashPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">其他费用冲抵：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.otherChargeOffset" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">服务费冲抵：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.serviceChargeOffset" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonPayment()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">对账当月工厂开票：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.lastMonInvoice" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonthEndDebt()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">调拨代理商开票：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.dealerAllotInvoice" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonthEndDebt()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">调拨徐工开票：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.xcmgAllotInvoice" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99"
                                ng-change="handleLastMonthEndDebt()">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">对账当月底备件欠款：</label>
                        <div class="col-xs-5 control-label" style="text-align: left;">{{detailInfo.lastMonthEndDebt||'-'}}</div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">信用额度：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.creditLimit" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">对账当月底逾期金额：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.lastMonthEndOverdue" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">本月回款任务：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.paymentTask" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">已开票未发货：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.unshipped" class="form-control"
                                yb-number-input disable-decimal="false" decimal-places="2" max="99999999.99">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">大区：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.reserve2" class="form-control" maxlength="20">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">代理商性质：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.reserve3" class="form-control" maxlength="20">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-xs-2 control-label">预留1：</label>
                        <div class="col-xs-5 wrapper-none">
                            <input type="text" ng-model="detailInfo.reserve1" class="form-control" maxlength="20">
                        </div>
                    </div>

                    <div class="form-group save-bar m-t-md">
                        <label class="col-xs-2 control-label"></label>
                        <div class="col-xs-5 wrapper-none">
                            <button type="button" class="btn btn-primary m-r-sm" ng-click="saveData(form.$valid)">保存</button>
                            <button type="button" class="btn btn-default" ng-click="cancel()">取消</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>